<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.laputa.service.model.BuildData"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
	<head>
		<base href="<%=basePath%>">
		<title>GroundID = ${groundID}, UserID = ${userID}</title>
		<link rel="stylesheet" type="text/css" href="default/default.css">
	</head>
	<!--
		buildFrame负责从buildData中读取各种建筑物的参数，并显示在屏幕上。
		然后根据用户选定的类型，设置buildingType，执行build.do。
	 -->
	 
	 <%
	 	BuildData buildData = (BuildData) request.getAttribute("buildData");
	  %>
	 
	 <c:forEach var="type" items="<%=buildData.getTypes()%>">
	 	<form method="post" action="build.do">
	 		<%
	 			long type = (Long)pageContext.findAttribute("type");
	 			long price = buildData.getPrice(type);
	 		 %>
	 		type = <%=type%>, price = <%=price%>
			<input type="hidden" name="buildingType" value="<%=type%>"/>
			<input type="hidden" name="price" value="<%=price%>"/>
			<input type="hidden" name="groundID" value="${groundID}"/>
			<input type="submit" name="build" value="建造!"/><br/>
		</form>
		<br/>
	 </c:forEach>
	 
	 <form method="post" action="login.do">
	 	<input type="submit" name="home" value="返回" />
	 </form>
</html>
